/*
Author: Max E. K
*/
using System;
using System.Collections;
using System.Collections.Generic;

namespace OpenGado.DATA.Entities
{
	/// <summary>
	/// Phone object for NHibernate mapped table 'phone'.
	/// </summary>
	[Serializable]
	public class Phone
	{
		#region Member Variables
		protected int _idphone;
		protected string _phonenumber;
		protected string _phonetype;
		protected Contact _contact;
		#endregion
		#region Constructors
			
		public Phone() {}
					
		public Phone(string phonenumber, string phonetype, Contact contact) 
		{
			this._phonenumber= phonenumber;
			this._phonetype= phonetype;
			this._contact= contact;
		}

		public Phone(Contact contact)
		{
			this._contact= contact;
		}
		
		#endregion
		#region Public Properties
		public  virtual int Idphone
		{
			get { return _idphone; }
			set {_idphone= value; }
		}
		public  virtual string PhoneNumber
		{
			get { return _phonenumber; }
			set {_phonenumber= value; }
		}
		public  virtual string PhoneType
		{
			get { return _phonetype; }
			set {_phonetype= value; }
		}
		public  virtual Contact Contact
		{
			get { return _contact; }
			set {_contact= value; }
		}
		#endregion
		
		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			Phone castObj = (Phone)obj;
			return ( castObj != null ) &&
			this._idphone == castObj.Idphone;
		}
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			int hash = 57;
			hash = 27 * hash * _idphone.GetHashCode();
			return hash;
		}
		#endregion
		
	}
}
